import logging

from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from portal import model
from portal.lib.base import BaseController, render

log = logging.getLogger(__name__)

class SpectaclesController(BaseController):

    def index(self):
        q = model.Session.query(model.Spectacle)
        c.spectacles = q.limit(20)
        
        return render('/spectacles/spectacles.mako')


    def view(self, param = None):
        q = model.Session.query(model.Spectacle).filter(model.Spectacle.id == param)
        c.spectacle = q.first()

        return render('/spectacles/spectacle_view.mako')